package com.jinghua.treatment;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 启动项,添加swagger2注解,测试时启动项目后浏览器输入localhost:8080/swagger-ui.html进入调试页面.MapperScan注解用来扫描注入dao层接口
 */
@SpringBootApplication
@EnableSwagger2
@MapperScan("com.jinghua.treatment.mapper")

public class TreatmentMedicinerApplication extends SpringBootServletInitializer {
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(TreatmentMedicinerApplication.class);
	}

	@Primary
	@Bean
	public TaskExecutor primaryTaskExecutor() {
		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
		// add necessary properties to the executor
		return executor;
	}

	public static void main(String[] args) {
		SpringApplication.run(TreatmentMedicinerApplication.class, args);
	}
}
